<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for javascripts/SqlLab/actions.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(../../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="../../index.html">All files</a> / <a href="index.html">javascripts/SqlLab</a> actions.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">41.55% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>59/142</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">6.25% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>2/32</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">29.85% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>20/67</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">43.7% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>59/135</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/* global notify */
import shortid from 'shortid';
import { now } from '../modules/dates';
const $ = require('jquery');
&nbsp;
export const RESET_STATE = 'RESET_STATE';
export const ADD_QUERY_EDITOR = 'ADD_QUERY_EDITOR';
export const CLONE_QUERY_TO_NEW_TAB = 'CLONE_QUERY_TO_NEW_TAB';
export const REMOVE_QUERY_EDITOR = 'REMOVE_QUERY_EDITOR';
export const MERGE_TABLE = 'MERGE_TABLE';
export const REMOVE_TABLE = 'REMOVE_TABLE';
export const END_QUERY = 'END_QUERY';
export const REMOVE_QUERY = 'REMOVE_QUERY';
export const EXPAND_TABLE = 'EXPAND_TABLE';
export const COLLAPSE_TABLE = 'COLLAPSE_TABLE';
export const QUERY_EDITOR_SETDB = 'QUERY_EDITOR_SETDB';
export const QUERY_EDITOR_SET_SCHEMA = 'QUERY_EDITOR_SET_SCHEMA';
export const QUERY_EDITOR_SET_TITLE = 'QUERY_EDITOR_SET_TITLE';
export const QUERY_EDITOR_SET_AUTORUN = 'QUERY_EDITOR_SET_AUTORUN';
export const QUERY_EDITOR_SET_SQL = 'QUERY_EDITOR_SET_SQL';
export const QUERY_EDITOR_SET_SELECTED_TEXT = 'QUERY_EDITOR_SET_SELECTED_TEXT';
export const SET_DATABASES = 'SET_DATABASES';
export const SET_ACTIVE_QUERY_EDITOR = 'SET_ACTIVE_QUERY_EDITOR';
export const SET_ACTIVE_SOUTHPANE_TAB = 'SET_ACTIVE_SOUTHPANE_TAB';
export const ADD_ALERT = 'ADD_ALERT';
export const REMOVE_ALERT = 'REMOVE_ALERT';
export const REFRESH_QUERIES = 'REFRESH_QUERIES';
export const RUN_QUERY = 'RUN_QUERY';
export const START_QUERY = 'START_QUERY';
export const STOP_QUERY = 'STOP_QUERY';
export const REQUEST_QUERY_RESULTS = 'REQUEST_QUERY_RESULTS';
export const QUERY_SUCCESS = 'QUERY_SUCCESS';
export const QUERY_FAILED = 'QUERY_FAILED';
export const CLEAR_QUERY_RESULTS = 'CLEAR_QUERY_RESULTS';
export const REMOVE_DATA_PREVIEW = 'REMOVE_DATA_PREVIEW';
export const CHANGE_DATA_PREVIEW_ID = 'CHANGE_DATA_PREVIEW_ID';
export const SAVE_QUERY = 'SAVE_QUERY';
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >resetState() {
<span class="cstat-no" title="statement not covered" >  return { type: RESET_STATE };</span>
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >saveQuery(query) {
  c</span>onst url = <span class="cstat-no" title="statement not covered" >'/savedqueryviewapi/api/create';
<span class="cstat-no" title="statement not covered" >  $.ajax({</span>
    type: 'POST',
    url,
    data: query,
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >    success: <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >() =&gt; notify.success('Your query was saved'),</span></span></span></span>
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >    error: <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >() =&gt; notify.error('Your query could not be saved'),</span></span></span></span>
    dataType: 'json',
  });
<span class="cstat-no" title="statement not covered" >  return { type: SAVE_QUERY };</span>
}
&nbsp;
export function startQuery(query) {
  Object.assign(query, {
    id: q</span>uery.id ? <span class="branch-0 cbranch-no" title="branch not covered" >query.id : shortid.generate(),
    progress: 0,
    startDttm: now(),
    state: (</span>query.runAsync) ? <span class="branch-0 cbranch-no" title="branch not covered" >'pending' : 'running',
    cached: false,
  });
  return { type: START_QUERY, query };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >querySuccess(query, results) {
<span class="cstat-no" title="statement not covered" >  return { type: QUERY_SUCCESS, query, results };</span>
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >queryFailed(query, msg) {
<span class="cstat-no" title="statement not covered" >  return { type: QUERY_FAILED, query, msg };</span>
}
&nbsp;
export function stopQuery(query) {
  return { type: STOP_QUERY, query };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >clearQueryResults(query) {
<span class="cstat-no" title="statement not covered" >  return { type: CLEAR_QUERY_RESULTS, query };</span>
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >removeDataPreview(table) {
<span class="cstat-no" title="statement not covered" >  return { type: REMOVE_DATA_PREVIEW, table };</span>
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >requestQueryResults(query) {
<span class="cstat-no" title="statement not covered" >  return { type: REQUEST_QUERY_RESULTS, query };</span>
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >fetchQueryResults(query) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
<span class="cstat-no" title="statement not covered" >    dispatch(requestQueryResults(query));</span>
    c</span>onst <span class="cstat-no" title="statement not covered" >sqlJsonUrl = `/superset/results/${query.resultsKey}/`;
<span class="cstat-no" title="statement not covered" >    $.ajax(<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" >{</span></span></span></span></span>
      type: 'GET',
      dataType: 'json',
      url: sqlJsonUrl,
      success(results) {
<span class="cstat-no" title="statement not covered" >        dispatch(querySuccess(query, results));</span>
      },
      error(err) {
        l</span>et msg = <span class="cstat-no" title="statement not covered" >'Failed at retrieving results from the results backend';
<span class="cstat-no" title="statement not covered" >        if (err.responseJSON &amp;&amp; err.responseJSON.error) {</span>
<span class="cstat-no" title="statement not covered" >          msg = err.responseJSON.error;</span>
        }
<span class="cstat-no" title="statement not covered" >        dispatch(queryFailed(query, msg));</span>
      },
    });
  };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >runQuery(query) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
<span class="cstat-no" title="statement not covered" >    dispatch(startQuery(query));</span>
    c</span>onst sqlJsonRequest = <span class="cstat-no" title="statement not covered" >{
      client_id: query.id,
      database_id: query.dbId,
      json: true,
      runAsync: query.runAsync,
      schema: query.schema,
      sql: query.sql,
      sql_editor_id: query.sqlEditorId,
      tab: query.tab,
      tmp_table_name: query.tempTableName,
      select_as_cta: query.ctas,
    };
    c</span>onst sqlJsonUrl = <span class="cstat-no" title="statement not covered" >'/superset/sql_json/' + location.search;
<span class="cstat-no" title="statement not covered" >    $.ajax(<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" >{</span></span></span></span></span>
      type: 'POST',
      dataType: 'json',
      url: sqlJsonUrl,
      data: sqlJsonRequest,
      success(results) {
<span class="cstat-no" title="statement not covered" >        if (!query.runAsync) {</span>
<span class="cstat-no" title="statement not covered" >          dispatch(querySuccess(query, results));</span>
        }
      },
      error(err, textStatus, errorThrown) {
        l</span>et <span class="cstat-no" title="statement not covered" >msg;
<span class="cstat-no" title="statement not covered" >        try {</span>
<span class="cstat-no" title="statement not covered" >          msg = err.responseJSON.error;</span>
        } catch (e) {
<span class="cstat-no" title="statement not covered" >          if (err.responseText !== undefined) {</span>
<span class="cstat-no" title="statement not covered" >            msg = err.responseText;</span>
          }
        }
<span class="cstat-no" title="statement not covered" >        if (textStatus === 'error' &amp;&amp; errorThrown === '') {</span>
<span class="cstat-no" title="statement not covered" >          msg = 'Could not connect to server';</span>
        } else <span class="cstat-no" title="statement not covered" >if (msg === null) {</span>
<span class="cstat-no" title="statement not covered" >          msg = `[${textStatus}] ${errorThrown}`;</span>
        }
<span class="cstat-no" title="statement not covered" >        dispatch(queryFailed(query, msg));</span>
      },
    });
  };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >postStopQuery(query) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
    c</span>onst stopQueryUrl = <span class="cstat-no" title="statement not covered" >'/superset/stop_query/';
    c</span>onst stopQueryRequestData = <span class="cstat-no" title="statement not covered" >{ client_id: query.id };
<span class="cstat-no" title="statement not covered" >    $.ajax(<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" ><span class="fstat-no" title="function not covered" >{</span></span></span></span>
      type: 'POST',
      dataType: 'json',
      url: stopQueryUrl,
      data: stopQueryRequestData,
      success() {
<span class="cstat-no" title="statement not covered" >        if (!query.runAsync) {</span>
<span class="cstat-no" title="statement not covered" >          dispatch(stopQuery(query));</span>
        }
      },
    });
  };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >setDatabases(databases) {
<span class="cstat-no" title="statement not covered" >  return { type: SET_DATABASES, databases };</span>
}
&nbsp;
export function addQueryEditor(queryEditor) {
  const newQe = Object.assign({}, queryEditor, { id: shortid.generate() });
  return { type: ADD_QUERY_EDITOR, queryEditor: newQe };
}
&nbsp;
export function cloneQueryToNewTab(query) {
  return { type: CLONE_QUERY_TO_NEW_TAB, query };
}
&nbsp;
export function addAlert(alert) {
  const o = Object.assign({}, alert);
  o.id = shortid.generate();
  return { type: ADD_ALERT, alert: o };
}
&nbsp;
export function removeAlert(alert) {
  return { type: REMOVE_ALERT, alert };
}
&nbsp;
export function setActiveQueryEditor(queryEditor) {
  return { type: SET_ACTIVE_QUERY_EDITOR, queryEditor };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >setActiveSouthPaneTab(tabId) {
<span class="cstat-no" title="statement not covered" >  return { type: SET_ACTIVE_SOUTHPANE_TAB, tabId };</span>
}
&nbsp;
export function removeQueryEditor(queryEditor) {
  return { type: REMOVE_QUERY_EDITOR, queryEditor };
}
&nbsp;
export function removeQuery(query) {
  return { type: REMOVE_QUERY, query };
}
&nbsp;
export function queryEditorSetDb(queryEditor, dbId) {
  return { type: QUERY_EDITOR_SETDB, queryEditor, dbId };
}
&nbsp;
export function queryEditorSetSchema(queryEditor, schema) {
  return { type: QUERY_EDITOR_SET_SCHEMA, queryEditor, schema };
}
&nbsp;
export function queryEditorSetAutorun(queryEditor, autorun) {
  return { type: QUERY_EDITOR_SET_AUTORUN, queryEditor, autorun };
}
&nbsp;
export function queryEditorSetTitle(queryEditor, title) {
  return { type: QUERY_EDITOR_SET_TITLE, queryEditor, title };
}
&nbsp;
export function queryEditorSetSql(queryEditor, sql) {
  return { type: QUERY_EDITOR_SET_SQL, queryEditor, sql };
}
&nbsp;
export function queryEditorSetSelectedText(queryEditor, sql) {
  return { type: QUERY_EDITOR_SET_SELECTED_TEXT, queryEditor, sql };
}
&nbsp;
export function mergeTable(table, query) {
  return { type: MERGE_TABLE, table, query };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >addTable(query, tableName, schemaName) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
    l</span>et <span class="cstat-no" title="statement not covered" >url = `/superset/table/${query.dbId}/${tableName}/${schemaName}/`;
<span class="cstat-no" title="statement not covered" >    $.get(url, <span class="fstat-no" title="function not covered" >(</span>data) =&gt; {</span>
      c</span>onst dataPreviewQuery = <span class="cstat-no" title="statement not covered" >{
        id: shortid.generate(),
        dbId: query.dbId,
        sql: data.selectStar,
        tableName,
        sqlEditorId: null,
        tab: '',
        runAsync: false,
        ctas: false,
      };
      // Merge table to tables in state
<span class="cstat-no" title="statement not covered" >      dispatch(mergeTable(</span>
        Object.assign(data, {
          dbId: query.dbId,
          queryEditorId: query.id,
          schema: schemaName,
          expanded: true,
        }), dataPreviewQuery)
      );
      // Run query to get preview data for table
<span class="cstat-no" title="statement not covered" >      dispatch(runQuery(dataPreviewQuery));</span>
    })
    .fail(<span class="fstat-no" title="function not covered" >() =&gt; </span>{
<span class="cstat-no" title="statement not covered" >      dispatch(</span>
        addAlert({
          msg: 'Error occurred while fetching metadata',
          bsStyle: 'danger',
        })
      );
    });
&nbsp;
<span class="cstat-no" title="statement not covered" >    url = `/superset/extra_table_metadata/${query.dbId}/${tableName}/${schemaName}/`;</span>
<span class="cstat-no" title="statement not covered" >    $.get(url, <span class="fstat-no" title="function not covered" >(</span>data) =&gt; {</span>
      c</span>onst table = <span class="cstat-no" title="statement not covered" >{
        dbId: query.dbId,
        queryEditorId: query.id,
        schema: schemaName,
        name: tableName,
      };
<span class="cstat-no" title="statement not covered" >      Object.assign(table, data);</span>
<span class="cstat-no" title="statement not covered" >      dispatch(mergeTable(table));</span>
    });
  };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >changeDataPreviewId(oldQueryId, newQuery) {
<span class="cstat-no" title="statement not covered" >  return { type: CHANGE_DATA_PREVIEW_ID, oldQueryId, newQuery };</span>
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >reFetchQueryResults(query) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
    c</span>onst newQuery = <span class="cstat-no" title="statement not covered" >{
      id: shortid.generate(),
      dbId: query.dbId,
      sql: query.sql,
      tableName: query.tableName,
      sqlEditorId: null,
      tab: '',
      runAsync: false,
      ctas: false,
    };
<span class="cstat-no" title="statement not covered" >    dispatch(runQuery(newQuery));</span>
<span class="cstat-no" title="statement not covered" >    dispatch(changeDataPreviewId(query.id, newQuery));</span>
  };
}
&nbsp;
export function expandTable(table) {
  return { type: EXPAND_TABLE, table };
}
&nbsp;
export function collapseTable(table) {
  return { type: COLLAPSE_TABLE, table };
}
&nbsp;
export function removeTable(table) {
  return { type: REMOVE_TABLE, table };
}
&nbsp;
export function refreshQueries(alteredQueries) {
  return { type: REFRESH_QUERIES, alteredQueries };
}
&nbsp;
export f</span>unction <span class="fstat-no" title="function not covered" >popStoredQuery(urlId) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
<span class="cstat-no" title="statement not covered" >    $.ajax({</span>
      type: 'GET',
      url: `/kv/${urlId}`,
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >      success: <span class="fstat-no" title="function not covered" >(</span>data) =&gt; {</span></span>
        c</span>onst newQuery = <span class="cstat-no" title="statement not covered" >JSON.parse(data);
        c</span>onst queryEditorProps = <span class="cstat-no" title="statement not covered" >{
          title: newQuery.title ? newQuery.title : 'shared query',
          dbId: newQuery.dbId ? parseInt(newQuery.dbId, 10) : null,
          schema: newQuery.schema ? newQuery.schema : null,
          autorun: newQuery.autorun ? newQuery.autorun : false,
          sql: newQuery.sql ? newQuery.sql : 'SELECT ...',
        };
<span class="cstat-no" title="statement not covered" >        dispatch(addQueryEditor(queryEditorProps));</span>
      },
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >      error: <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >() =&gt; notify.error("The query couldn't be loaded"),</span></span></span></span>
    });
  };
}
export f</span>unction <span class="fstat-no" title="function not covered" >popSavedQuery(saveQueryId) {
<span class="cstat-no" title="statement not covered" >  return <span class="fstat-no" title="function not covered" >function (</span>dispatch) {</span>
<span class="cstat-no" title="statement not covered" >    $.ajax({</span>
      type: 'GET',
      url: `/savedqueryviewapi/api/get/${saveQueryId}`,
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >      success: <span class="fstat-no" title="function not covered" >(</span>data) =&gt; {</span></span>
        c</span>onst sq = <span class="cstat-no" title="statement not covered" >data.result;
        c</span>onst queryEditorProps = <span class="cstat-no" title="statement not covered" >{
          title: sq.label,
          dbId: sq.db_id ? parseInt(sq.db_id, 10) : null,
          schema: sq.schema,
          autorun: false,
          sql: sq.sql,
        };
<span class="cstat-no" title="statement not covered" >        dispatch(addQueryEditor(queryEditorProps));</span>
      },
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >      error: <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >() =&gt; notify.error("The query couldn't be loaded"),</span></span></span></span>
    });
  };
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Apr 11 2017 20:15:55 GMT-0700 (PDT)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
